{extend name="public:layout" /}
{block name="title"}添加{$moudleName}{/block}
{block name="head"}{/block}
{block name="body"}
<div class="wrapper wrapper-content">
    <div class="ibox">
        <div class="ibox-title">
            <ol class="breadcrumb">
                <li>
                    <i class="fa fa-hand-o-right"></i>
                    <a href="{:url('index',['mid'=>$Request.param.mid,'cid'=>$Request.param.cid])}">{$moudleName}列表</a>
                </li>
                <li class="active">添加{$moudleName}</li>
            </ol>
        </div>
        <div class="ibox-content">
            <form method="post" class="form-horizontal" id="form">
                <div class="form-group">
<label class="col-sm-2 control-label Validform_label">标题</label>
<div class="col-sm-8">
    <input class="form-control" type="text" placeholder="" name="title" value="" datatype="*" />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label Validform_label">客户名称</label>
<div class="col-sm-3">
    {:widget('common/Form/custombox',['btype_name','','widget|common/Form/custombox|select:car_btype:btype_name,btype_name'])}
</div>
<label class="col-sm-2 control-label Validform_label">费用类型</label><div class="col-sm-3">
<label class="radio-inline i-checks"><input type='radio' name="cost_type" class="cost_type" value="0" checked/> 客户付款</label>
<label class="radio-inline i-checks"><input type='radio' name="cost_type" class="cost_type" value="1" /> 日常开销</label></div>
</div>
<div class="form-group">
<div class="box box0">
<label class="col-sm-2 control-label Validform_label">费用明细</label>
<div class="col-sm-3">
    {:widget('common/Form/custombox',['cost_detail1','','widget|common/Form/custombox|select:dict:dict_name,dict_name:type_id=111'])}
</div>
</div>
<div class="box box1">
<label class="col-sm-2 control-label Validform_label">费用明细</label>
<div class="col-sm-3">
    {:widget('common/Form/custombox',['cost_detail2','','widget|common/Form/custombox|select:dict:dict_name,dict_name:type_id=112'])}
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label Validform_label">费用金额</label>
<div class="col-sm-3">
    <input class="form-control" type="text" placeholder="费用金额" name="cost_money" value="0" datatype="*" />
</div>
<label class="col-sm-2 control-label Validform_label">付款时间</label>
<div class="col-sm-3">
    <input class="form-control laydatetime" type="text" placeholder="付款时间" name="cost_time" value="" />
</div>
<script>formatDate();</script>
</div>
<div class="form-group">
<label class="col-sm-2 control-label Validform_label">备注</label>
<div class="col-sm-8">
    <input class="form-control" type="text" placeholder="备注" name="cost_desc" value=""  />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label Validform_label">排序</label>
<div class="col-sm-3">
    <input class="form-control" type="text" placeholder="" name="sort" value="0" datatype="*" />
</div>
</div>

                <div class="form-group">
                    <div class="col-sm-10 col-sm-offset-2">
                        <button class="btn btn-primary" id="btnSub" type="button">保存</button>
                        <a href="{:url('index',['mid'=>$Request.param.mid])}" class="btn btn-white">取消</a>
                        <span id="validError"></span>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    $(function () {
        iCheck();
        formatDate();
        ajaxSubForm('#btnSub');
		test();
		$("input[name='cost_type']").on('ifChecked', function(event){
            test();
        });
		function test(){
			$('.box').hide();
			var index = $('.cost_type:checked').val();
			$('.box'+index).show();
		}
    });
	
</script>
{/block}